<?php
header('Content-Type: text/html; charset=windows-1251');
if($_SERVER['HTTP_X_REQUESTED_WITH'] == 'XMLHttpRequest') {
	if($_GET['q']){
		$q = iconv("utf-8", "cp1251", $_GET['q']);
		$base = @file("city.html");
			for($i=0; $i<count($base); $i++){
			$row_base = explode(":", $base[$i]);
			$res = mb_strpos(mb_strtolower($row_base[0]), mb_strtolower($q));
			if($res!==false && $res==0) {
				$row_base[1] = trim($row_base[1]);
				print $row_base[0]."\n";
			}
		}
	}
}
?>